/**
 * 安卓白金英雄坛制作组
 * <br>
 * 文件名：StuntScreen.java
 * <br>
 * 创建时间：2013-8-12 上午10:31:26
 * <br>
 * 所属项目：GmudEX
 * <br>
 *
 * @author 12548
 *         <br>
 */
package lostland.gmud.exv2.battle.proc;

import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseInfo;
import com.orhanobut.logger.Logger;

import java.util.ArrayList;

import lostland.general.network.GmudHttp;
import lostland.general.network.GmudRequestListener;
import lostland.general.network.GmudRestUrl;
import lostland.gmud.exv2.FontSize;
import lostland.gmud.exv2.Game;
import lostland.gmud.exv2.GameConstants;
import lostland.gmud.exv2.battle.BattleScreen;
import lostland.gmud.exv2.battle.ControlScreen;
import lostland.gmud.exv2.battle.PureViewScreen;
import lostland.gmud.exv2.battle.StuntData;
import lostland.gmud.exv2.battle.ViewScreen;
import lostland.gmud.exv2.battle.netbattle.ClientViewScreen;
import lostland.gmud.exv2.battle.netbattle.NetworkMode;
import lostland.gmud.exv2.battle.proc.stunt.BanZiJue;
import lostland.gmud.exv2.battle.proc.stunt.ChanZiJue;
import lostland.gmud.exv2.battle.proc.stunt.DaLiJinGangZhi;
import lostland.gmud.exv2.battle.proc.stunt.EHuXiao;
import lostland.gmud.exv2.battle.proc.stunt.FeiLongTanYun;
import lostland.gmud.exv2.battle.proc.stunt.JiZiJue;
import lostland.gmud.exv2.battle.proc.stunt.LiuLangWenYing;
import lostland.gmud.exv2.battle.proc.stunt.LiuXingFeiZhi;
import lostland.gmud.exv2.battle.proc.stunt.LuanHuanJue;
import lostland.gmud.exv2.battle.proc.stunt.LuoYingBinFen;
import lostland.gmud.exv2.battle.proc.stunt.QianKunYiZhi;
import lostland.gmud.exv2.battle.proc.stunt.SanHuanTaoYue;
import lostland.gmud.exv2.battle.proc.stunt.ShenDaoGuiDie;
import lostland.gmud.exv2.battle.proc.stunt.ShenSengXiangMo;
import lostland.gmud.exv2.battle.proc.stunt.XueHuaLiuChu;
import lostland.gmud.exv2.battle.proc.stunt.YiDaoZhan;
import lostland.gmud.exv2.battle.proc.stunt.YinYangJue;
import lostland.gmud.exv2.battle.proc.stunt.ZhenZiJue;
import lostland.gmud.exv2.battle.proc.stunt.ZhuanZiJue;
import lostland.gmud.exv2.blgframework.impl.BLGGraphics;
import lostland.gmud.exv2.data.Npc;
import lostland.gmud.exv2.data.Room;
import lostland.gmud.exv2.ui.NotificationScreen;
import lostland.gmud.exv2.ui.core.ArrowButton;
import lostland.gmud.exv2.ui.core.GmudWindow;
import lostland.gmud.exv2.ui.core.MenuScreen;

/**
 * 类名：StuntScreen
 * <br>
 * 说明：特定武功的绝招
 *
 * @author 12548
 */
public class StuntScreen extends MenuScreen {

// /**
// * 绝招列表
// */
// public static final String name[] = new String[]{
// "震字诀","挤字诀","阴阳诀","乱环诀","缠字诀","连字诀","三环套月","流星飞掷","雪花六出","神倒鬼跌",
// "落英缤纷","柳浪闻莺","化掌为刀","八卦刀影掌","八阵刀影掌","化掌为刀","旋风三连斩","迎风一刀斩","雷动九天","红莲出世",
// "冰心诀","三花","忍术烟幕","忍法影分身","乾坤一掷","飞龙探云手","恶虎啸","飞鹰召唤","闪展腾挪"
// };
//
// /**
// * 发动绝招所需要装备的武器的类别(subkind)<br>
// * 1刀 6剑 7杖 9鞭 11拳脚
// */
// public static final int weaponskNeeded[] = new int[]{
// 11,11,11,11,6,6,6,7,6,11,
// 9,1,11,1,1,11,1,1,11,11,
// 11,11,11,11,11,11,11,11,11
// };
//
// /**
// * 发动绝招所需要的技能和等级
// */
// public static final int sklNeeded[][] = new int[][]{
// {1,31,0,32},{60,60,60,60},//震字诀
// {1,31,0,32},{70,70,70,70},//挤字诀
// {1,31,0,32},{120,120,120,120},//阴阳
// {1,31,0,32},{100,100,100,100},//乱环
// {2,30,0,32},{80,80,80,80},//缠字决
// {2,30,0,32},{80,80,80,80},//连字诀
// {2,30,0,32},{120,120,120,120},//三环套月
// {0,25,5,23},{80,80,80,80},//流星飞掷
// {2,38,0,36},{60,60,60,60},//雪花六出
// {1,39,0,36},{80,80,100,100},//神倒鬼跌
// {6,17,0,20},{80,80,80,80},//落英缤纷
// {1,3,18,0,20},{20,100,100,100,100},//柳浪闻莺
// {12,1,0,14},{70,70,70,70},//化掌为刀
// {11,0,14},{90,70,70},
// {11,0,14},{90,70,70},
// {0,1,13},{90,90,90},//化掌为刀
// {0,26,3,29},{80,80,60,60},
// {0,26,3,29},{80,80,80,80},
// {0,25},{60,60},//雷动九天
// {0,25},{80,80},
// {0,36},{60,60},
// {0,20},{60,60},
// {0,26},{60,60},//忍术烟幕
// {0,26},{80,80},
// {0},{0},
// {0},{0},
// {1,40,0},{80,100,120},
// {1,47,0},{80,100,100},
// {0,50},{20,40}
// };
//
// /**
// * 发动一次绝招所耗费的内力
// */
// public static final int cost[] = new int[]{
// 200,350,300,500,250,350,400,850,600,700,
// 400,400,200,450,150,400,350,550,150,350,
// 250,350,300,550,0,100,300,200,150
// };
//
// /**
// * 收招回合（发动一次后的间隔时间）
// */
// public static final int cd[] = new int[]{
// 2,2,6,9,6,9,5,5,4,9,
// 4,4,4,4,4,4,7,7,5,5,
// 5,5,5,5,5,1,6,5,2
// };

	static int cnt = 0;
	static int[] t = new int[10];
	static ArrayList<String> s = new ArrayList<>();
	public static int i;

	public StuntScreen() {
		super(getWindows());

		dummyBorder = new GmudWindow(48, 44, 70, 12 * cnt + 2) {
			@Override
			public void draw() {
				drawBackground();
			}
		};
	}

	/**
	 * 绝招能否发动的判断
	 *
	 * @param zdp   发动方
	 * @param index 绝招ID
	 */
	public static boolean canuse(Npc zdp, int index) {
		return StuntData.getInstance(index).canUse(zdp) == null;
	}

	/**
	 * 设置持续时间
	 *
	 * @param zdp   发动方
	 * @param index 绝招ID<br>
	 *              连字诀 化掌为刀1 三花 忍术烟幕 忍法影分身 冰心诀 化掌为刀2 飞鹰召唤 闪展腾挪
	 */
	static void setBuff(Npc zdp, int index) {
		switch (index) {
			case 5:
				zdp.setBuff(0, 8);
				break;
			case 12:
				zdp.setBuff(1, zdp.getBuff(1) + 4);
				break;
			case 21:
				zdp.setBuff(2, zdp.getBuff(2) + (zdp.skills[0] + zdp.skills[20]) / 40);
				break;
			case 22:
				zdp.setBuff(3, zdp.getBuff(3) + (zdp.skills[0] + zdp.skills[26]) / 40);
				break;
			case 23:
				zdp.setBuff(4, zdp.getBuff(4) + (zdp.skills[0] + zdp.skills[26]) / 40);
				break;
			case 20:
				zdp.setBuff(5, zdp.getBuff(5) + 9);
				break;
			case 15:
				zdp.setBuff(6, zdp.getBuff(6) + 7);
				break;
			case 27:
				zdp.setBuff(7, zdp.getBuff(7) + (zdp.skills[1] + zdp.skills[47]) / 40);
				break;
			case 28:
				zdp.setBuff(8, zdp.getBuff(8) + (zdp.skills[0] + zdp.skills[50]) / 40);
				break;
			case 31:
				zdp.setBuff(9, zdp.getBuff(9) + 5);
				break;
			case 34:
				zdp.setBuff(10, zdp.getBuff(10) + 5);
			default:
				break;
		}
	}

	/*
	 * （非 Javadoc）
	 * @see lostland.gmud.exv2.ui.MenuScreen#onClick(int)
	 */
	@Override
	protected void onClick(int index) {

		String s = StuntData.getInstance(t[index]).canUse(BattleScreen.getInstance().p1());

		if (s == null) {

			if (BattleScreen.getInstance().networkMode != NetworkMode.CLIENT) {
				getGame().popScreen();
				process(BattleScreen.getInstance().p1(), BattleScreen.getInstance().p2(), t[index]);
			} else {
				RequestParams rParams = GmudHttp.initBattleParams();
				rParams.addBodyParameter("action", 1 + "");
				rParams.addBodyParameter("tag", t[index] + "");
				new GmudHttp("正在发送数据......").postLocked(GmudRestUrl.ClientAction, rParams, new GmudRequestListener() {

					@Override
					public void onSucc(ResponseInfo<String> info) {
						StuntScreen.this.replaceBy(new ClientViewScreen());
						return;
					}

					@Override
					public void onFail(HttpException error, String msg) {
						getGame().popToRootScreen();
						new NotificationScreen("网络错误！！").pushToGame();
					}
				});
			}
		} else {
			new PureViewScreen(s).pushToGame();
		}

	}


	@Override
	public void onCancel() {
		new ControlScreen().replaceCurrent();
	}

	public static void StuntOver() {
// AttackStatus.ts = new RoundOverStatus();
// GmudWorld.bs.setStatus(new DummyStatus());
// GmudWorld.bs.setStatus(new AnotherDummyStatus(new RoundOverStatus()));

// Gmud.bs.push(new DummyStatus());

// GmudWorld.game.setScreen(new ViewScreen(GmudWorld.game));
	}


	/*
	 * （非 Javadoc）
	 * @see lostland.gmud.exv2.ui.core.ButtonControlledScreen#show()
	 */
	@Override
	protected void show() {
		BattleScreen.getInstance().present(0.01f);
		dummyBorder.draw();
		for (int i = 0; i < cnt; i++) {
			buttons[i].draw();
		}
	}

	/**
	 * 在战斗界面显示的绝招列表
	 */
	static GmudWindow[] getWindows() {

		cnt = 0;
		t = new int[10];
		s = new ArrayList<>();


		for (StuntData itm : StuntData.getInstance()) {
			boolean flag = true;

			for (int i = 0; i < 5; i++) {
				if (itm.equipSkillNeeded[i] > -1
						&& BattleScreen.getInstance().p1().skillsckd[i] != itm.equipSkillNeeded[i]) {
					flag = false;
//					GmudGame.logError("绝招不可用", itm.name + "装备技能不符！！");
					break;
				}
			}

			if (itm.weaponType > -1 && itm.weaponType != BattleScreen.getInstance().p1().getAttackItem().getSubkind()) {
				flag = false;
//				GmudGame.logError("绝招不可用", itm.name + "装备武器不符！！");
			}

			if (itm.talentNeeded > -1 && itm.talentNeeded != BattleScreen.getInstance().p1().talent) {
				flag = false;
//				GmudGame.logError("绝招不可用", itm.name + "装备天赋不符！！");
			}

			if (flag) {
				t[s.size()] = itm.id;
				s.add(itm.name);
				cnt++;
			}

		}


		ArrowButton[] tw = new ArrowButton[cnt];
		for (i = 0; i < cnt; i++) {
			tw[i] = new ArrowButton(49, 45 + 12 * i, 60, 12) {
				final int a = i;

				@Override
				public void draw() {
					drawBackground();
					BLGGraphics g = (BLGGraphics) Game.getInstance().getGraphics();
					g.drawText(s.get(a), x + 8, y, FontSize.FT_12PX);
				}
			};
		}

		return tw;
	}

	/**
	 * 绝招发动
	 *
	 * @param zdp   发动方
	 * @param bdp   承受方
	 * @param index 绝招ID
	 */
	public static void process(Npc zdp, Npc bdp, int index) {
		switch (index) {
			case 0:// 震字诀
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"突然$N双手左右连划，一个圆圈已将$n套住，太极拳的震字诀随即使出！")).pushToGame();
				new ZhenZiJue(zdp, bdp).pushToBattle();
				break;
			case 1:// 挤字诀
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N右脚实，左脚虚，运起 [挤] 字诀，粘连粘随，右掌翻出已搭住$n左手！")).pushToGame();
				new JiZiJue(zdp, bdp).pushToBattle();
				break;
			case 2:// 阴阳诀
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"[太极阴阳少人修，吞吐开合问刚柔] ，这阴阳决使用时刚柔并济，委时变幻莫测！")).pushToGame();
				new YinYangJue(zdp, bdp).pushToBattle();
				break;
			case 3:// 乱环诀
				new ViewScreen(BattleScreen
						.bsp(zdp, bdp, "$N将一个个太极圆圈发出，以四两之微力，拨动$n的千斤巨力 ！")).pushToGame();
				new LuanHuanJue(zdp, bdp).pushToBattle();
				break;
			case 4:// 缠字诀
				new ViewScreen(BattleScreen
						.bsp(zdp, bdp, "$N每一招均是以弧形刺出，弧形收回，绵绵不绝，逐步向$n收紧！")).pushToGame();
				new ChanZiJue(zdp, bdp).pushToBattle();
				break;
			case 5:// 连字诀
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N手中剑不断划圈，剑光圈一个未消另一个再生，这光圈剑阵一出，真是守御滴水不漏！")).pushToGame();
				zdp.setEvd_bouns(zdp.getEvd_bouns() + zdp.skills[30] / 10);
				zdp.setHit_bouns(zdp.getHit_bouns() + 10);
				setBuff(zdp, index);
// GmudWorld.bs.setStatus(new RoundOverStatus(zdp, bdp));
				break;
			case 6:// 三环套月
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N剑尖斜指，使出太极剑绝学三环套月，连环三招直向$n攻来！")).pushToGame();
				new SanHuanTaoYue(zdp, bdp, 143).pushToBattle();
				break;
			case 7:// 流星飞掷

// if(zdp.getAttr(Room.ATTR_STR)<32)
// {
// GmudGame.getInstance().pushScreen(new ViewScreen(GmudGame.getInstance(),
// BattleScreen.bsp(zdp,bdp,"你膂力不够，不能使用流星飞掷！"));
// GmudGame.getInstance().setScreen(new ViewScreen(GmudGame.getInstance()));
// return;
// }
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N运足内力长啸一声，将手中$w向$n猛掷过来，去势急劲，当真快若闪电！")).pushToGame();

				new LiuXingFeiZhi(zdp, bdp).pushToBattle();
				break;
			case 8:// 雪花六出
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N长啸一声，使出雪山神技雪花六出，依照雪花六角之型，一瞬间向$n刺出数剑！")).pushToGame();
				new XueHuaLiuChu(zdp, bdp).pushToBattle();
				break;
			case 9:// 神倒鬼跌
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N使出绝技神倒鬼跌三连环，一揪一抓一拌接连三招，据说神仙也要摔个跟头！")).pushToGame();
				new ShenDaoGuiDie(zdp, bdp).pushToBattle();
				break;
			case 10:// 落英缤纷
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N手中$w轻舞，划出一个又一个圈子，$n跟著鞭圈一绕，登时眼花缭乱！")).pushToGame();
				new LuoYingBinFen(zdp, bdp).pushToBattle();
				break;
			case 11:// 柳浪闻莺
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N使出柳浪闻莺绝技，向$n同时击出两掌一刀，一时间刀浪如柳，掌风如莺！")).pushToGame();
				new LiuLangWenYing(zdp, bdp).pushToBattle();
				break;
			case 12:// 化掌为刀
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N呼喝一声，将混元一气功逼到双掌，掌心闪出奇异的光芒，掌缘锋利竟如钢刀一般！")).pushToGame();
				zdp.setHit_bouns(zdp.getHit_bouns() + (zdp.skills[1] + zdp.skills[12]) / 20);
				setBuff(zdp, index);
// GmudWorld.bs.setStatus(new RoundOverStatus(zdp, bdp));
				break;
			case 13:// 八卦刀影掌
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N使出八卦门刀影掌绝学，一时间刀光闪闪，掌风呼啸，刀光掌影直向$n扑来！")).pushToGame();
				new LiuLangWenYing(zdp, bdp).pushToBattle();
				break;
			case 14:// 八卦刀影掌
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N使出八卦门刀影掌绝学，一时间刀光闪闪，掌风呼啸，刀光掌影直向$n扑来！")).pushToGame();
				new LiuLangWenYing(zdp, bdp).pushToBattle();
				break;
			case 15:// 化掌为刀
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N呼喝一声，将混元一气功逼到双掌，掌心闪出奇异的光芒，掌缘锋利竟如钢刀一般！")).pushToGame();
				zdp.setStr_bouns(zdp.getStr_bouns() + zdp.skills[13] / 5);
				zdp.setHit_bouns(zdp.getHit_bouns() + zdp.skills[13] / 10);
// zdp.setTransfixed(zdp.getDz()+1);
				// 原版为+3，但在安卓白金坛环境下，如此长时间的呆若木鸡无疑是致命的
				setBuff(zdp, index);
// GmudWorld.bs.setStatus(new RoundOverStatus());
				break;
			case 16:// 旋风三连斩
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N刀指苍穹蓄势发力，忽地使出旋风三连斩绝技，身形如风连续劈出三刀！")).pushToGame();
				new SanHuanTaoYue(zdp, bdp, 132).pushToBattle();
				break;
			case 17:// 迎风一刀斩
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N反手握刀纵声长啸，霎时间天地为之变色，这一刀之势虽然平平，却威力惊人！")).pushToGame();
				new YiDaoZhan(zdp, bdp).pushToBattle();
				break;
			case 18:// 雷动九天
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N默念红莲教义，周身啪啪做响，真气流转间，好像手上的力道加强了！")).pushToGame();
				zdp.setStr_bouns(zdp.getStr_bouns() + (3 + (zdp.skills[0] + zdp.skills[25]) / 10));
// GmudWorld.bs.setStatus(new RoundOverStatus(zdp, bdp));
				break;
			case 19:// 红莲出世
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N合眼默诵红莲教义：去残除恶，唯我光明！忽地睁开双眼，似乎增加了战斗力！")).pushToGame();
				zdp.setHit_bouns(zdp.getHit_bouns() + (-3 + (zdp.skills[0] + zdp.skills[25]) / 10));
// zdp.setTransfixed(zdp.getDz()+1);
// GmudWorld.bs.setStatus(new RoundOverStatus());
				break;
			case 20:// 冰心诀
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N深吸一口气，全身真气流转，周身竟隐隐发出一片如冰雪般的晶莹之色！")).pushToGame();
				zdp.setDef_bouns(zdp.getDef_bouns() + (zdp.skills[0] + zdp.skills[36] * 2) / 12);
				setBuff(zdp, index);
// GmudWorld.bs.setStatus(new RoundOverStatus());
				break;
			case 21:// 三花
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N凝神运功，周身泛出一片七彩绚烂之色，似乎披了一见五彩霓裳，身法骤然变快！")).pushToGame();
				zdp.setAgi_bouns(zdp.getAgi_bouns() + zdp.skills[20] / 10);
				zdp.setEvd_bouns(zdp.getEvd_bouns() + ((zdp.skills[0] + zdp.skills[20] * 2) / 10 - 5));
				setBuff(zdp, index);
// GmudWorld.bs.setStatus(new RoundOverStatus());
				break;
			case 22:// 忍术烟幕
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N双手连挥，一掌击在地上，腾的一声爆起一阵烟幕，$n眼前顿时一片昏暗！")).pushToGame();

				double hit_rate = 0.8 + 0.2 * (((double) zdp.getFp() - bdp.getFp()) / (zdp.getFp() + bdp.getFp() + 1));

				Logger.i("命中率=" + hit_rate);

				boolean hit = Math.random() < hit_rate;

				if (hit) {
					setBuff(zdp, index);
					bdp.setHit_bouns(bdp.getHit_bouns() - 20);
// GmudWorld.bs.setStatus(new RoundOverStatus());
				} else {
					new Status(zdp, bdp) {
						@Override
						public void execute() {
							new ViewScreen(BattleScreen.bsp(zdp, bdp,
									"没想到$n内力深厚，当即猛推一掌，震散了烟雾！")).pushToGame();
							zdp.setTransfixed(zdp.getDz() + 3);
							StuntOver();
						}
					}.pushToBattle();
				}
				break;
			case 23:// 忍法影分身
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N双手合掌身形急转，一声低喝中，身影一分为二，$n一时竟分辩不出真假！")).pushToGame();
				setBuff(zdp, index);
// GmudWorld.bs.setStatus(new RoundOverStatus());
				break;
			case 24: // 乾坤一掷
				if (zdp.gold < 100000) {
					new ViewScreen(BattleScreen.bsp(zdp, bdp,
							"你金钱不够，不能使用乾坤一掷！")).pushToGame();
					return;
				}
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N发动【乾坤一掷】袋中金钱化为一道金色闪电向$n猛劈过来！")).pushToGame();
				new QianKunYiZhi(zdp, bdp).pushToBattle();
				break;
			case 25: // 飞龙探云
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N发动绝技【飞龙探云手】探向$n囊中！")).pushToGame();
				new FeiLongTanYun(zdp, bdp).pushToBattle();
				break;
			case 26: // 恶虎啸
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N昂首而立，“啊呜”一声，发出如恶虎一般的啸声，声音凄厉，夺人心魄！")).pushToGame();
				new EHuXiao(zdp, bdp).pushToBattle();
				break;
			case 27: // 飞鹰召唤
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N嘬唇长啸，唿哨声中半空里一声长鸣，一只金眼铁爪苍鹰盘旋而至！")).pushToGame();
				zdp.setAgi_bouns(zdp.getAgi_bouns() + zdp.skills[47] / 10);
				zdp.setEvd_bouns(zdp.getEvd_bouns() + ((zdp.skills[1] + zdp.skills[47] * 2) / 10 - 5));
				setBuff(zdp, index);
				break;
			case 28: // 闪展腾挪
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N催动挪移心法，施展出闪展腾挪之术！")).pushToGame();
				zdp.setHit_bouns(zdp.getHit_bouns() + zdp.skills[50] / 10);
				zdp.setEvd_bouns(zdp.getEvd_bouns() + ((zdp.skills[0] + zdp.skills[50] * 2) / 10 - 5));
				setBuff(zdp, index);
				BattleScreen.getInstance().qkdny1 = true;
				break;

			case 29: // 大力金刚指
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N聚气凝神，浑身力道集中在右手指尖，大喝一声，点向$n的$1。")).pushToGame();
				new DaLiJinGangZhi(zdp, bdp).pushToBattle();
				break;
			case 30:
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N口中默念佛经，将手中$w绕了个弧，挂起一阵狂风，狠狠扫向$n的伤口。")).pushToGame();
				new ShenSengXiangMo(zdp, bdp).pushToBattle();
				break;
			case 31: {
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N突然俯身运气，手中$w顿时像一条灵巧的龙一般缠向$n的下盘")).pushToGame();

				double hit_rate1 = (zdp.getAttr(Room.ATTR_AGI) - bdp.getAttr(Room.ATTR_AGI) + 80.0) / 100.0;

				Logger.i("命中率=" + hit_rate1);

				boolean hit1 = Math.random() < hit_rate1;

				if (hit1) {
					setBuff(zdp, index);
					bdp.setHit_bouns(bdp.getHit_bouns() - 10);
					bdp.setEvd_bouns(bdp.getEvd_bouns() - 10);
					bdp.setAgi_bouns(bdp.getAgi_bouns() - 10);
// GmudWorld.bs.setStatus(new RoundOverStatus());
					new Status(zdp, bdp) {
						@Override
						public void execute() {
							new ViewScreen(BattleScreen.bsp(zdp, bdp,
									"$n立刻就被$w束缚起来。虽然很快便用力挣脱，但是双腿受了伤害，身法顿时大减。 ")).pushToGame();
							StuntOver();
						}
					}.pushToBattle();
				} else {
					new Status(zdp, bdp) {
						@Override
						public void execute() {
							new ViewScreen(BattleScreen.bsp(zdp, bdp,
									"$n用力一跃，躲开了$N的攻击")).pushToGame();
							zdp.setTransfixed(zdp.getDz() + 3);
							StuntOver();
						}
					}.pushToBattle();
				}
				break;
			}
			case 32:
				// 转字诀
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N使用转字诀，对$n连出三棍！")).pushToGame();
				new ZhuanZiJue(zdp, bdp).pushToBattle();
				break;
			case 33:
				// 绊字诀
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N使用绊字诀，手中$w向$n下盘连环绊去！")).pushToGame();
				new BanZiJue(zdp, bdp).pushToBattle();
				break;

			case 34:
				// 封字诀
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N手中$w化作一团光影，猛点$n周身要穴！")).pushToGame();

				setBuff(zdp, index);

				bdp.setStunt(false);
				new Status(zdp, bdp) {
					@Override
					public void execute() {
						new ViewScreen(BattleScreen.bsp(zdp, bdp,
								"$n只觉全身酥酥麻麻，再也使不上力气！")).pushToGame();
						StuntOver();
					}
				}.pushToBattle();

				break;

			case 35:
				new ViewScreen(BattleScreen.bsp(zdp, bdp,
						"$N大喝一声，身体变得模糊起来，似乎有一种黑白光影围绕周身！")).pushToGame();
				zdp.setEvd_bouns(zdp.getEvd_bouns() + 50);
		}

		zdp.addGauge(-GameConstants.STUNT_GAUGE_COST);
		zdp.setFp(zdp.getFp() - StuntData.getInstance(index).cost);
		zdp.setSz(index, StuntData.getInstance(index).cd);

		if (zdp.haveTalent(101)) { // 天赋效果 清虚若谷
			zdp.setFp(zdp.getFp() + StuntData.getInstance(index).cost);
			zdp.setSz(index, 0);
		}


	}

}
